package com.imooc.collection

object ArrayApp extends App{

//  val a = new Array[String](5)
//
//  println(a.length)
//  a(1) = "hello"
//
//  println(a)
//  println(a(1))
//
//  val b = Array("Hadoop","spark","storm")
//  b(1) = "hive"
//
//  println(b(1))
//
  val c = Array(2,3,4,5,6,7,8,9)
//  println(c.sum)
//  println(c.max)
//  println(c.min)
//
//  println(c.mkString(","))
//  println(c.mkString("<",",",">"))




  val d = scala.collection.mutable.ArrayBuffer[Int]()
  println(d.length)

  d += 1
  d += 2
  d += (3 , 4 , 5)
  d ++= c
  d.insert(0,0)
  d.remove(1)
  d.remove(0,3)
  d.trimEnd(2)

  d.toArray

  d.foreach(ele => print(ele))

  println()

  for(ele <- c.reverse){
    print(ele)
  }




}
